package com.thientan.service

import com.thientan.export.ExportRequest;
import com.thientan.model.HopDong
import com.thientan.model.KhachHang

class HopDongService extends AbstractService {

	HopDong edit(HopDong hd, KhachHang kh) {
		kh.save()
		hd.save()
	}
	
	/**
	* Return the widths of columns in the export file when export list of domains.
	*/
   protected Long[] getColWidth() {
	   return [30 ,50 ,50, 70, 45 ,40,70]as Long[]
   }

   /**
	* Return the column's headers in the export file when export list of domains.
	* */
   protected String[] getColTitles() {
	   return ['STT', 'Ngày trả', 'Tiền thu','Tiền còn nợ', 'KH ký', 'TN ký', 'Tên thu ngân'] as String[]
   }

   /**
	* Return the fields of domain to export.
	* */
   protected String[] getColNames() {
	   return ['stt', 'ngaytra', 'tienthu','tienconno','khky','tnky', 'tenthungan']as String[]
   }

   /**
	* Return the type of columns when export list of domains.
	* */
   protected Class<?>[] getExportColType() {
	   return [Integer.class, String.class, String.class, String.class, String.class, String.class, String.class]as Class<?>[]
   }
   
   void prepareParametersBeforeExport(ExportRequest er){
	   er.addParameter("ngayin", this.exportData?.ngayin)
	   er.addParameter("tenkhachhang", this.exportData?.tenkhachhang)
	   er.addParameter("diachi", this.exportData?.diachi)
	   er.addParameter("dienthoai", this.exportData?.dienthoai)
	   er.addParameter("tongtien", this.exportData?.tongtien)
	   er.addParameter("doitruong", this.exportData?.doitruong)
	   er.addParameter("nv1", this.exportData?.nv1)
	   er.addParameter("nv2", this.exportData?.nv2)
	   er.addParameter("tratruoc", this.exportData?.tratruoc)
	   er.addParameter("conlai", this.exportData?.conlai)
	   er.addParameter("mahopdong", this.exportData?.mahopdong)
	   er.addParameter("mavachpath", this.exportData?.mavachpath)
	   er.addParameter("logopath", this.exportData?.logopath)
   }
}
